/* 工作流预览页面样式 */

/* ========== 全局样式 ========== */
.workflow-preview-page {
    background: #f0f2f5;
    min-height: 100vh;
    padding: 2rem 0;
}

.workflow-preview-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ========== 页面标题区域 ========== */
.workflow-header {
    background: #1890ff;
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
}

.workflow-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: float 6s ease-in-out infinite;
}

.workflow-header h1 {
    font-size: 2.5rem;
    font-weight: 600;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.workflow-header .subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-top: 0.5rem;
}

/* ========== 卡片样式 ========== */
.workflow-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 1px solid #f0f0f0;
    margin-bottom: 2rem;
    overflow: hidden;
    transition: all 0.3s ease;
}

.workflow-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.workflow-card-header {
    background: #fafafa;
    color: #262626;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
}

.workflow-card-header h5 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #262626;
}

.workflow-card-header i {
    font-size: 1.2rem;
    color: #1890ff;
}

.workflow-card-body {
    padding: 2rem;
}

/* ========== 基本信息样式 ========== */
.workflow-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.workflow-info-item {
    background: #fafafa;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #f0f0f0;
    border-left: 4px solid #1890ff;
    transition: all 0.3s ease;
}

.workflow-info-item:hover {
    border-left-color: #40a9ff;
    box-shadow: 0 2px 8px rgba(24, 144, 255, 0.15);
}

.workflow-info-label {
    font-weight: 600;
    color: #8c8c8c;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    display: block;
}

.workflow-info-value {
    font-size: 1.1rem;
    color: #262626;
    font-weight: 500;
}

.workflow-description {
    background: #fffbe6;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #ffe58f;
    border-left: 4px solid #faad14;
    margin-top: 1rem;
}

/* ========== 状态徽章样式 ========== */
.workflow-status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.workflow-status-badge.status-enabled {
    background: #f6ffed;
    color: #52c41a;
    border: 1px solid #b7eb8f;
}

.workflow-status-badge.status-disabled {
    background: #fff2e8;
    color: #fa8c16;
    border: 1px solid #ffd591;
}

.workflow-status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ========== 流程图样式 ========== */
.workflow-diagram-container {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    min-height: 700px;
    position: relative;
    overflow: auto;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

#workflow-diagram {
    position: relative;
    z-index: 1;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    background: #fafafa;
    transition: all 0.3s ease;
    min-height: 650px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

#workflow-diagram:hover {
    border-color: #1890ff;
    background: #f0f5ff;
    box-shadow: 0 2px 8px rgba(24, 144, 255, 0.15);
}

/* Mermaid 流程图样式优化 */
#workflow-diagram .mermaid {
    width: 100%;
    height: auto;
    min-height: 400px;
}

/* 优化 Mermaid SVG 样式 */
#workflow-diagram svg {
    max-width: 100%;
    height: auto !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

/* 节点文字样式 */
#workflow-diagram .node text {
    font-size: 14px !important;
    font-weight: 500 !important;
    fill: #262626 !important;
}

/* 连接线样式 */
#workflow-diagram .edgePath path {
    stroke: #1890ff !important;
    stroke-width: 2px !important;
    fill: none !important;
}

/* 箭头样式 */
#workflow-diagram .arrowheadPath {
    fill: #1890ff !important;
    stroke: #1890ff !important;
}

/* 连接线标签样式 */
#workflow-diagram .edgeLabel {
    background-color: white !important;
    border: 1px solid #f0f0f0 !important;
    border-radius: 4px !important;
    padding: 4px 8px !important;
    font-size: 12px !important;
    color: #8c8c8c !important;
}

/* 节点悬停效果 */
#workflow-diagram .node:hover rect,
#workflow-diagram .node:hover circle,
#workflow-diagram .node:hover polygon {
    filter: brightness(1.1) !important;
    cursor: pointer !important;
}

/* 流程图缩放和平移控制 */
.workflow-diagram-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.diagram-control-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #d9d9d9;
    background: white;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    color: #8c8c8c;
}

.diagram-control-btn:hover {
    border-color: #1890ff;
    color: #1890ff;
    background: #f0f5ff;
}

.diagram-control-btn:active {
    transform: scale(0.95);
}

/* ========== 表格样式 ========== */
.workflow-table-container {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #f0f0f0;
}

.workflow-table {
    margin: 0;
    font-size: 0.95rem;
}

.workflow-table thead th {
    background: #fafafa;
    color: #262626;
    font-weight: 600;
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
}

.workflow-table tbody tr {
    transition: all 0.3s ease;
    border-bottom: 1px solid #f5f5f5;
}

.workflow-table tbody tr:hover {
    background: #f0f5ff;
}

.workflow-table tbody td {
    padding: 1rem;
    vertical-align: middle;
    border: none;
}

/* ========== 节点类型徽章 ========== */
.node-type-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid;
}

.node-type-badge.type-start {
    background: #f6ffed;
    color: #52c41a;
    border-color: #b7eb8f;
}

.node-type-badge.type-approval {
    background: #f0f5ff;
    color: #1890ff;
    border-color: #adc6ff;
}

.node-type-badge.type-condition {
    background: #fff2e8;
    color: #fa8c16;
    border-color: #ffd591;
}

.node-type-badge.type-end {
    background: #fff1f0;
    color: #f5222d;
    border-color: #ffa39e;
}

/* ========== 加载动画 ========== */
.workflow-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #8c8c8c;
}

.workflow-loading .spinner {
    width: 2rem;
    height: 2rem;
    border: 2px solid #f0f0f0;
    border-top: 2px solid #1890ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.workflow-loading-text {
    font-size: 0.9rem;
    font-weight: 400;
    color: #8c8c8c;
}

/* ========== 错误状态样式 ========== */
.workflow-error {
    text-align: center;
    padding: 3rem;
    color: #f5222d;
}

.workflow-error i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.8;
    color: #ff7875;
}

.workflow-error h4 {
    color: #f5222d;
    font-weight: 600;
    margin-bottom: 1rem;
}

.workflow-error p {
    color: #8c8c8c;
    font-size: 1rem;
}

.error-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.workflow-error .btn {
    background: #1890ff;
    border: 1px solid #1890ff;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.workflow-error .btn-primary {
    background: #1890ff;
    border-color: #1890ff;
    color: white;
}

.workflow-error .btn-primary:hover {
    background: #40a9ff;
    border-color: #40a9ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(24, 144, 255, 0.3);
}

.workflow-error .btn-outline-secondary {
    background: transparent;
    color: #8c8c8c;
    border: 1px solid #d9d9d9;
}

.workflow-error .btn-outline-secondary:hover {
    background: #f5f5f5;
    border-color: #1890ff;
    color: #1890ff;
    transform: translateY(-2px);
}

/* ========== 动画定义 ========== */
@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(180deg); }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* ========== 响应式设计 ========== */
@media (max-width: 1200px) {
    .workflow-diagram-controls {
        top: 0.5rem;
        right: 0.5rem;
        gap: 0.25rem;
    }
    
    .diagram-control-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}

@media (max-width: 768px) {
    .workflow-preview-page {
        padding: 1rem 0;
    }
    
    .workflow-header {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .workflow-header h1 {
        font-size: 2rem;
    }
    
    .workflow-info-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .workflow-card-body {
        padding: 1.5rem;
    }
    
    .workflow-diagram-container {
        padding: 1rem;
        min-height: 500px;
    }
    
    #workflow-diagram {
        min-height: 450px;
        padding: 1.5rem;
    }
    
    .workflow-diagram-controls {
        position: relative;
        top: auto;
        right: auto;
        justify-content: center;
        margin-bottom: 1rem;
        background: white;
        padding: 0.5rem;
        border-radius: 8px;
        border: 1px solid #f0f0f0;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
    
    .workflow-table {
        font-size: 0.85rem;
    }
    
    .workflow-table thead th,
    .workflow-table tbody td {
        padding: 0.75rem 0.5rem;
    }
}

@media (max-width: 576px) {
    .workflow-preview-container {
        padding: 0.5rem;
    }
    
    .workflow-header h1 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }
    
    .subtitle {
        font-size: 0.9rem;
    }
    
    .workflow-info-item {
        padding: 1rem;
    }
    
    .workflow-info-label {
        font-size: 0.85rem;
    }
    
    .workflow-info-value {
        font-size: 0.9rem;
    }
    
    .workflow-diagram-container {
        min-height: 400px;
        padding: 0.5rem;
    }
    
    #workflow-diagram {
        min-height: 350px;
        padding: 1rem;
    }
    
    .diagram-control-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .workflow-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .workflow-table {
        min-width: 600px;
        font-size: 0.8rem;
    }
}

/* ========== 深色模式支持 ========== */
@media (prefers-color-scheme: dark) {
    .workflow-preview-page {
        background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    }
    
    .workflow-card {
        background: #3a4a5c;
        color: #ecf0f1;
    }
    
    .workflow-info-item {
        background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
        color: #ecf0f1;
    }
    
    .workflow-table tbody tr:hover {
        background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
    }
}

/* ========== 打印样式 ========== */
@media print {
    .workflow-preview-page {
        background: white;
        padding: 0;
    }
    
    .workflow-header {
        background: #f8f9fa !important;
        color: #333 !important;
    }
    
    .workflow-card {
        box-shadow: none;
        border: 1px solid #ddd;
        break-inside: avoid;
    }
    
    .workflow-card-header {
        background: #f8f9fa !important;
        color: #333 !important;
    }
}
